
<template>
<div>
  <el-steps :active="listdata.result" align-center>
  <el-step title="步骤1" description="待审请"></el-step>
  <el-step title="步骤2" description="待审批"></el-step>
  <el-step title="步骤3" description="已审批"></el-step>
</el-steps>
</br>
</br>
  <el-table
    :data="datalist"
    style="width: 100%"
    max-height="250">
    <el-table-column
      fixed
      prop="id"
      label="编号"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="150">
    </el-table-column>
    <el-table-column
      prop="email"
      label="邮箱"
      width="230">
    </el-table-column>
    <el-table-column
      prop="content"
      label="内容"
      width="400">
    </el-table-column>
    <el-table-column
      prop="resultstr"
      label="结果"
      width="120">
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      width="150">
      <template slot-scope="scope">
        <el-button
          @click.native.prevent="deleteRow()"
          type="text"
          size="small">
          撤回申请
        </el-button>
      </template>
    </el-table-column>
  </el-table>
  <el-button :loading="loading" round type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="getinfo">查询更新</el-button>
</div>

</template>

<script>
import indexApi from '@/api/certification/index.js'
import indexApi1 from '@/api/certification/index.js'
  export default {

    data() {
      return {
        listdata:{         
          result:1,
        },
        datalist:[]
    }
  },

   created() { // 在渲染之前执行
        this.task()
        
  
    },
    mounted() { // 在渲染之后执行   

       
    },
    methods: {
          task(){
            indexApi1.getemail().then(response => {
              const authority=response.data.authority
              if(authority===1){
                this.$alert('你已经是管理员了', '权限认证', {
                    confirmButtonText: '确定',
                    callback: action => {
                        this.$router.push(`/login`)
                        }
                    })
                }
              })
          } ,

      getinfo(){
        indexApi.getbyinfo().then(response => {
          if(response.data.result>=3){
              this.listdata.result=3
          }else{
            this.listdata.result=response.data.result
          }
          this.datalist=response.data.list
        })
      },

      deleteRow() {
        indexApi.removeinfo(this.datalist).then(response => {
          this.$router.push(`/login`)
        })
      }
    }
  }
</script>